package ru.common;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Yuri Zemlyanskiy <urikz@yandex-team.ru>
 * Date: 05.05.2011
 */
public class CommonUtils {

    public static <T> List<T> toList(final Iterable<T> iterable) {
        final ArrayList<T> result = new ArrayList<T>();
        for (final T t : iterable) {
            result.add(t);
        }
        return result;
    }

    public static <T> Iterable<T> iterable(final Iterator<T> iterator) {
        return new Iterable<T>() {
            public Iterator<T> iterator() {
                return iterator;
            }
        };
    }



}
